<!DOCTYPE html>
<html>

<head>

    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">


    <title>TI费用预算格式管理</title>
    <meta name="keywords" content="">
    <meta name="description" content="">

    <link rel="shortcut icon" href="favicon.ico"> 
    <link href="__STATIC__/layout/css/bootstrap.min.css?v=3.3.6" rel="stylesheet">
    <link href="__STATIC__/layout/css/font-awesome.css?v=4.4.0" rel="stylesheet">
  
    <link href="__STATIC__/layout/css/animate.css" rel="stylesheet">
    <link href="__STATIC__/layout/css/style.css?v=4.1.0" rel="stylesheet">
    <link href="__STATIC__/layout/css/plugins/sweetalert/sweetalert.css" rel="stylesheet">
    <link rel="stylesheet" href="__STATIC__/zTreeStyle/demo.css" type="text/css">
    <link rel="stylesheet" href="__STATIC__/zTreeStyle/zTreeStyle.css" type="text/css">
     <link href="__STATIC__/layout/css/gyq.css" rel="stylesheet">
    <link rel="stylesheet" href="__STATIC__/layout/css/demo.css" type="text/css">
    <style>
      
    </style>
</head>

<body class="white-bg" style="color:#333;padding:3px;">
    <div class="page-heade">
       <h2 class="title_color text-center">TI费用预算格式管理</h2>
    </div>
        <div class="col-md-12 mtp no-padding">
			<form id="f1" class="form-inline">
			<input type="hidden" name="type_name" value="TI费用预算格式"/>
               <table class="table table-bordered" style="width: 100%;">
               		<tr>
						<td style="width: 30%;">是否设置过TI费用预算格式:</td>
						<td style="width: 70%;">{if condition="$ishas eq 1"}已设置过TI费用预算格式，请查看导入格式是否正确。<a href="{:url('Xitongexcel/tiyuasuan_daochu')}">TI费用预算导入格式下载</a>{else/}尚未设置{/if}</td>
               		</tr>
               		<tr>
						<td style="width: 30%;">是否设置渠道纬度:</td>
						<td style="width: 70%;">
							{if condition="$target[0]['channel_id'] neq ''"}
							<label><input type="radio" class='shownext' checked name="channel" value='1'/>是</label>
							<label><input type="radio" class='hidenext' name="channel" value='0'/>否</label>
							{else/}
							<label><input type="radio" class='shownext' name="channel" value='1'/>是</label>
							<label><input type="radio" class='hidenext' checked name="channel" value='0'/>否</label>
							{/if}
						</td>
               		</tr>
               		<tr>
						<td style="width: 30%;">渠道纬度:</td>
						<td style="width: 70%;">
							<select id="channel_id" name="channel_id" class="form-control select">
								{volist name='list' id="vo"}
									{if condition="$vo.field_name eq '一级渠道'"}
										{if condition="$target[0]['channel_id'] eq $vo.id"}
										<option value='{$vo.id}' selected>{$vo.field_name}</option>
										{else/}
										<option value='{$vo.id}'>{$vo.field_name}</option>
										{/if}
									{/if}
								{/volist}
							</select>
						</td>
               		</tr>
               		<tr>
						<td style="width: 30%;">是否设置区域及客户纬度:</td>
						<td style="width: 70%;">
							{if condition="$target[0]['area_id'] neq '' or $target[0]['client_id'] neq ''"}
							<label><input type="radio" class='shownext' checked name="area" value='1'/>是</label>
							<label><input type="radio" class='hidenext' name="area" value='0'/>否</label>
							{else/}
							<label><input type="radio" class='shownext' name="area" value='1'/>是</label>
							<label><input type="radio" class='hidenext' checked  name="area" value='0'/>否</label>
							{/if}
						</td>
               		</tr>
               		<tr>
						<td style="width: 30%;">区域及客户纬度:</td>
						<td style="width: 70%;">
							<select id="area_id" name="area_id" class="form-control select">
								{volist name='list' id="vo"}
									{if condition="$vo.pname eq '区域' or $vo.field_name eq '经销商'"}
										{if condition="$target[0]['area_id'] eq $vo.id or $target[0]['client_id'] eq $vo.id"}
										<option value='{$vo.id}' selected>{$vo.field_name}</option>
										{else/}
										<option value='{$vo.id}'>{$vo.field_name}</option>
										{/if}
									{/if}
								{/volist}
							</select>
						</td>
               		</tr>
               		<tr>
						<td style="width: 30%;">是否设置产品纬度:</td>
						<td style="width: 70%;">
						{if condition="$target[0]['product_id'] neq ''"}
							<label><input type="radio" class='shownext' checked name="product" value='1'/>是</label>
							<label><input type="radio" class='hidenext' name="product" value='0'/>否</label>
							{else/}
							<label><input type="radio" class='shownext'  name="product" value='1'/>是</label>
							<label><input type="radio" class='hidenext' checked name="product" value='0'/>否</label>
							{/if}
						</td>
               		</tr>
               		<tr>
						<td style="width: 30%;">产品纬度:</td>
						<td style="width: 70%;">
							<select id="product_id" name="product_id" class="form-control select">
								{volist name='list' id="vo"}
									{if condition="$vo.pname eq '产品'"}
										{if condition="$target[0]['product_id'] eq $vo.id"}
										<option value='{$vo.id}' selected>{$vo.field_name}</option>
										{else/}
										<option value='{$vo.id}'>{$vo.field_name}</option>
										{/if}
									{/if}
								{/volist}
							</select>
						</td>
               		</tr>
               		
               		<tr>
						<td style="width: 30%;">是否设置费用类型纬度:</td>
						<td style="width: 70%;">
						{if condition="$target[0]['feiyong_id'] neq ''"}
							<label><input type="radio" class='shownext' checked name="feiyong" value='1'/>是</label>
							<label><input type="radio" class='hidenext' name="feiyong" value='0'/>否</label>
							{else/}
							<label><input type="radio" class='shownext'  name="feiyong" value='1'/>是</label>
							<label><input type="radio" class='hidenext' checked name="feiyong" value='0'/>否</label>
							{/if}
						</td>
               		</tr>
               		<tr>
						<td style="width: 30%;">费用类型纬度:</td>
						<td style="width: 70%;">
							<select id="feiyong_id" name="feiyong_id" class="form-control select">
								{volist name='list' id="vo"}
									{if condition="$vo.pname eq '费用类型'"}
										{if condition="$target[0]['feiyong_id'] eq $vo.id"}
										<option value='{$vo.id}' selected>{$vo.field_name}</option>
										{else/}
										<option value='{$vo.id}'>{$vo.field_name}</option>
										{/if}
									{/if}
								{/volist}
							</select>
						</td>
               		</tr>
               		<tr>
						<td style="width: 30%;">是否设置人员纬度:</td>
						<td style="width: 70%;">
							{if condition="$target[0]['people_id'] eq 1"}
							<label><input type="radio"  checked name="people_id" value='1'/>是</label>
							<label><input type="radio"  name="people_id" value='0'/>否</label>
							{else/}
							<label><input type="radio"  name="people_id" value='1'/>是</label>
							<label><input type="radio"  checked name="people_id" value='0'/>否</label>
							{/if}
						</td>
               		</tr>
               		
               		<tr>
						<td style="width: 30%;">考核期:</td>
						<td style="width: 70%;">
							<select id="kaoheqi" name="kaoheqi" class="form-control select">
								{volist name='list' id="vo"}
									{if condition="$vo.pname eq '考核期'"}
										{if condition="$target[0]['kaoheqi'] eq $vo.id"}
										<option value='{$vo.id}' selected>{$vo.field_name}</option>
										{else/}
										<option value='{$vo.id}'>{$vo.field_name}</option>
										{/if}
									{/if}
								{/volist}
							</select>
						</td>
               		</tr>
               </table>
               </form>
               <div class="text-center"><input type="button" value="保存格式" id="bc" class="btn btn-sm btn-primary"/><br/><br/><br/></div>
            
		
		
			
        </div>

    <!-- 全局js -->
    <script src="__STATIC__/layout/js/jquery.min.js?v=2.1.4"></script>
    <script src="__STATIC__/layout/js/bootstrap.min.js?v=3.3.6"></script>
     <!-- Peity -->
    <script src="__STATIC__/layout/js/plugins/peity/jquery.peity.min.js"></script>

    <!-- jqGrid -->
    <script src="__STATIC__/layout/js/plugins/jqgrid/i18n/grid.locale-cn.js?0820"></script>
    <script src="__STATIC__/layout/js/plugins/jqgrid/jquery.jqGrid.min.js?0820"></script>

    <!-- 自定义js -->
    <script src="__STATIC__/layout/js/content.js?v=1.0.0"></script>
     <script src="__STATIC__/layout/js/plugins/sweetalert/sweetalert.min.js"></script>
    
    <!-- ztree -->
    <script type="text/javascript" src="__STATIC__/zTreeStyle/jquery.ztree.core.js"></script>
    <script type="text/javascript" src="__STATIC__/zTreeStyle/jquery.ztree.excheck.js"></script>
    <!--统计代码，可删除-->
	<script>
	function ckhide(){
		$(".hidenext").each(function(){
			if($(this).prop("checked")){
				$(this).parent().parent().parent().next().hide();
			}
		})
	}
	$(function(){
		 ckhide();
		

		$(".shownext").change(function(){
			if($(this).prop("checked")){
				$(this).parent().parent().parent().next().show();
			}
		})
		$(".hidenext").change(function(){
			if($(this).prop("checked")){
				$(this).parent().parent().parent().next().hide();
			}
		})
		//保存
		$("#bc").click(function(){
			$.ajax({
                cache: true,
                type: "POST",
                url:"{:url('Xitongexcel/tiyuansuanbc')}",
                data:$('#f1').serialize(),// 你的formid
                async: false,
                error: function(request) {
                    alert("Connection error");
                },
                success: function(data) {
                	//alert(data);
                    if(data==1){
                    	 swal({
                                    title: "完成",
                                    text:  "操作已成功",
                                    type: "success"
                                    },function(){
                                        location.href='{:url("Xitongexcel/tiyuasuan")}';
                                    });
                    }else{
                    	  swal({
                                    title: "错误",
                                    text:  "系统繁忙请稍后再试",
                                    type: "warning"
                                    });
                    }
                }
            });
		})
		
	})
	</script>	
</body>
	
</html>
